﻿#include "MinestCostClimbStairs.h"


#ifdef DEV_TEST
#include <gtest/gtest.h>

struct MinestCostClimbStairsTestCase
{
	std::string costNums;
	int expectCost;

	friend std::ostream& operator<<(std::ostream& os, const MinestCostClimbStairsTestCase& obj)
	{
		return os
			<< "costNums: " << obj.costNums
			<< " expectCost: " << obj.expectCost;
	}
};

class MinestCostClimbStairsTest :public SolutionTestor<IMinestCostClimbStairs, testing::TestWithParam<MinestCostClimbStairsTestCase>>
{
protected:
	void LoadSolutions(std::vector<IMinestCostClimbStairs*>& solutions) override
	{
		solutions = { new MinestCostClimbStairs::DP };
	}
};
TEST_P(MinestCostClimbStairsTest, minestCostClimbStairs)
{
	TestForSolutions([](IMinestCostClimbStairs* solution)
		{
			auto testCase = GetParam();
			std::vector<int> costs;
			FormatedUtil::parseFormated(costs, testCase.costNums);
			auto result = solution->minestCostClimbStairs(costs);
			EXPECT_EQ(result, testCase.expectCost);
		});
}
INSTANTIATE_TEST_SUITE_P(ValidityTestCases, MinestCostClimbStairsTest, testing::Values(
	MinestCostClimbStairsTestCase{ "[2,5,20]",5 },
	MinestCostClimbStairsTestCase{ "[1,100,1,1,1,90,1,1,80,1]",6 }
));
#endif